import {getSalt, getPk} from "@/api/sign";

export default {
  namespaced: true,
  state: {
    salt: '',
    pk: ''
  },
  mutations: {
    setSalt(state, salt) {
      state.salt = salt
    },
    setPk(state, pk) {
      state.pk = pk
    }
  },
  actions: {
    async fetchSalt({commit}) {
      let salt = await getSalt()
      commit('setSalt', salt)
      return salt
    },
    // 一进入登录页则调用、获取加密公钥
    async fetchPk({commit}) {
      let pk = await getPk()
      commit('setPk', pk)
      return pk
    }
  }
}
